package com.example.routeplansystem.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.example.routeplansystem.algorithm.AlgorithmEnum;
import com.example.routeplansystem.anotation.UserPermissionConf;
import com.example.routeplansystem.entity.dto.ResponseEntity;
import com.example.routeplansystem.entity.vo.AlgorithmVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * @Author lucong
 * @Date 2022/7/12
 * @Description
 */
@RequestMapping("algorithm")
@RestController
@Api(tags = "算法模块")
@Validated
@UserPermissionConf
public class AlgorithmController {

    @GetMapping("/list")
    @ApiOperation("获取算法名称以及id")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "questionId", paramType = "query", value = "问题Id", required = true)
    })
    public ResponseEntity<List<AlgorithmVO>> listAlgorithm(@RequestParam(defaultValue = "0") Integer type){
        List<AlgorithmVO> list = new ArrayList<>();
        for (AlgorithmEnum value : AlgorithmEnum.values()) {
            AlgorithmVO algorithmVO = new AlgorithmVO(value.value, value.name);
            list.add(algorithmVO);
        }
        return new ResponseEntity<>(list);
    }


}
